package me.flyray.crm.core.modules.netty.rest;

import java.util.Map;

import javax.validation.Valid;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.github.wxiaoqi.security.biz.common.crm.request.LockManagerReq;

import me.flyray.crm.core.modules.netty.service.LockManageService;

/**
 * 超市锁--对外
 * @author chj
 *
 */
@Controller
@RequestMapping("lockApi")
public class LockManageController {

	private final static Logger logger = LoggerFactory.getLogger(LockManageController.class);
	
	@Autowired
	private LockManageService lockManageService;
	
	/**
	 * 锁 open/close
	 * @param map
	 * @return
	 * @throws Exception 
	 */
	@RequestMapping(value = "/lock/handle", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> handleLock(@RequestBody @Valid LockManagerReq lockManagerReq) throws Exception {
		logger.info("锁操作。。。{}"+lockManagerReq);
		return lockManageService.lockStateManage(lockManagerReq);
	}
	
}
